
public class TrainingImage {

	public static final int blockSize = 4;
	public static final int numberOfColumns = 23;
	public static final int numberofRows = 28;
	
	private double[][] originalImage;
	private double[][] lowFrequencyImage;
	private String FileName;
	
	public String getFileName(){
		return this.FileName;
	}
	public TrainingImage(double[][] originalImage, String fileName)
	{
		this.originalImage = originalImage;
		this.lowFrequencyImage = computeLowFrequencyImage(originalImage);
		this.FileName = fileName;
	}
	
	public static double[][] computeLowFrequencyImage(double[][] originalImage) {
		double[][] lowFreq = new double[numberofRows][numberOfColumns];
		int freqX = 0;
		int freqY = 0;
		for (int i = 0; i < originalImage.length; i = i+blockSize) {
			for (int j = 0; j < originalImage[0].length; j = j+blockSize) {
				double blockSum = 0.0;
				for (int k = i; k < i + blockSize; k++) {
					for (int k2 = j; k2 < j + blockSize; k2++) {
						blockSum += originalImage[k][k2];
					}
				}
				lowFreq[freqX][freqY] = blockSum;
				freqY++;
			}
			freqY = 0;
			freqX++;
		}
		return lowFreq;
	}

	public double[][] getOriginalImage(){
		return this.originalImage;
	}
	
	public void setOriginalImage(double[][] image){
		this.originalImage = image;
	}
	
	public double[][] getLowFrequencyImage(){
		return this.lowFrequencyImage;
	}
}
